<!DOCTYPE html> 
<html lang="ja"> 
    <head> 
        <meta charset="utf-8"> 
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>DOMElement Style Test | TM Lib</title>
        
        <style>
            body { font-family: "Meiryo", "メイリオ", "ヒラギノ角ゴ Pro W3", sans-serif; }
            
            #content {
                display: -webkit-box;
                display: -moz-box;
                display: -o-box;
                display: box;
            }
            
            #content>* {
                padding: 10px 20px;
                width: 50%;
                -webkit-box-sizing: border-box;
                -moz-box-sizing: border-box;
                -o-box-sizing: border-box;
                box-sizing: border-box;
            }
            
            .box {
                margin-top: 5px;
                margin-bottom: 5px;
                padding: 10px;
                border: 1px solid black;
            }
            
            #target {
                width: 100px;
                height: 100px;
            }
            
        </style>
        
        <script type="text/javascript" src="./../../src/tmlib.js"></script>
        <script id="test-script">
            
            TM.loadScript("dom", "dom");
            
            /*
             * Test
             */
            TM.main(function()
            {
                // コンソール生成
                var c = TM.DebugConsole("#console");
                
                // 
                c.group("field test(fixed)");
                
                var style = TM.$DOMStyle( TM.$query("#target") );
                // set
                style.set("width", "200px");
                // get
                c.log("width    : ", style.get("width"));
                c.log("height   : ", style.get("height"));
                // css で設定した値を考慮した値を取得する場合は get ではなく getPropValue を使用する.
                c.log("width    : ", style.getPropValue("width"));
                c.log("height   : ", style.getPropValue("height"));
                // 削除
                style.remove("width");
                c.log("width    : ", style.getPropValue("width"));
                c.log("height   : ", style.getPropValue("height"));
                
                c.groupEnd();
            });
            
        </script>
        
        <script>
            TM.addNamespace("prettify", "./../../plugins/prettify");
            TM.loadPrettify();
            
            TM.main(function(){
                TM.$id("code").innerText = TM.$id("test-script").innerText;
                prettyPrint();
            });
        </script>
    </head>
    
    <body>
         
        <h1>DOMElement Style Test | TM Lib</h1>
        
        <div id="content">
            <section>
                <h2>DOMElement Test</h2>
                <section>
                    <div id="target" class="box">
                </section>
                <h2>Console</h2>
                <pre id="console" class="prettyprint"></pre>
            </section>
            <section>
                <h2>Code</h2>
                <pre id="code" class="prettyprint"></pre>
            </section>
        </div>
        
        
    </body>
</html>
